﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ObjectPersistence;
using KYO.DAL;

public partial class Modules_Mod_Information_InformationDetail : Controller<Information>
{
    InformationAssembler service = new InformationAssembler();
   
    protected void Page_Load(object sender, EventArgs e)
    {
        
        int inforId = UrlRequestHandler.GetInforId();
        Model = service.ReadSingleByKey(inforId);
        lb_title.InnerHtml = Model.Title;
        content.InnerHtml = "<br/><br/>" + Model.Abstract + "<br/><br/>" + Model.Content;

        ListComments1.UpdateView(Model.CommentCollection);


    }
    protected override void OnInit(EventArgs e)
    {
        InformationComment1.SubmitClick += new EventHandler(InformationComment1_SubmitClick);
        base.OnInit(e);
    }

    void InformationComment1_SubmitClick(object sender, EventArgs e)
    {
        Comment comment = new Comment();
        comment = InformationComment1.UpdateModel(comment);
        comment.DateCreate = DateTime.Now.ToUniversalTime();
        Model.CommentCollection.Add(comment);
        service.MakePersistent(Model, true);
        
        

    }
}
